/*
暴力枚举
#include <iostream>
#include <cstring>
#include <vector>
#include <map>
#include <string>
#include <set>
#define int long long
using namespace std;

signed main()
{
    int n;
    cin >> n;
    vector<int>arr(n + 10);
    vector<int>brr(n + 10);
    vector<int>ans(n + 10);


    for(int i = 1;  i <= n; i ++) cin >> arr[i];
    for(int i = 1;  i <= n; i ++) cin >> brr[i];

    int cnt = 0;
    for(int i = 1; i <= n; i ++)
    {
        if(arr[i] == brr[i]) cnt ++;
    }

    for(int i = 1; i <= n; i ++)
    {
        int sum = cnt;
        //区间为奇数
        int l = i;
        int r = i;
        while(l >= 1 && r <= n)
        {
            sum += (arr[l] == brr[r]) + (arr[r] == brr[l]) - (arr[l] == brr[l]) - (arr[r] == brr[r]);
            ans[sum]++;
            l --; r ++;
        }
        sum = cnt;
        //区间为偶数
        l = i - 1;
        r = i;
        while(l >= 1 && r <= n)
        {
            sum += (arr[l] == brr[r]) + (arr[r] == brr[l]) - (arr[l] == brr[l]) - (arr[r] == brr[r]);
            ans[sum]++;
            l --; r ++;
        }
    }
    for(int i = 0 ; i <= n; i ++) cout << ans[i] << endl;
}
*/
//区间dp
#include <iostream>
#include <cstring>
#include <vector>
#include <map>
#include <string>
#include <set>

const int N = 7500 + 10;

int arr[N];
int brr[N];
int ans[N];

int dp[N][N];

using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;


    for(int i = 1;  i <= n; i ++) cin >> arr[i];
    for(int i = 1;  i <= n; i ++) cin >> brr[i];

    int cnt = 0;
    for(int i = 1; i <= n; i ++)
    {
        if(arr[i] == brr[i]) cnt ++;
    }
    for(int i = 1; i <= n; i ++)
    {
        dp[i][i] = cnt;//处理区间为1的情况
        dp[i + 1][i] = cnt;//单独处理区间为2的情况
        ans[cnt]++;
    }

    for(int len = 2; len <= n; len ++)//当区间为2时,i + 1 > j - 1,只需判断这两个点的变化的关系，所以初始化dp[i][i + 1] = cnt;
    {
        for(int i = 1; i + len - 1 <= n; i ++)
        {
            int j = i + len - 1;
            dp[i][j] = dp[i + 1][j - 1] + (arr[i] == brr[j]) + (arr[j] == brr[i]) - (arr[i] == brr[i]) - (arr[j] == brr[j]);
            ans[dp[i][j]]++;
            // cout << i << " " << j << endl;
        }
    }
    for(int i = 0 ; i <= n; i ++) cout << ans[i] << endl;
}